<?php

namespace App\Models;

use Carbon\Carbon;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Sign extends Model
{
    use HasFactory;

    protected $guarded = [''];

    /**
     * @param int $user_id
     * @param string $startTime
     * @param string $endTime
     * @return bool
     */
    public function getUserSignByTime($user_id, $startTime, $endTime)
    {
        return $this->query()
            ->where('user_id',$user_id)
            ->whereBetween('sign_time',[$startTime,$endTime])
            ->exists();
    }


}
